﻿<cfsilent>
	<cfscript>
		
		/* 各学院成绩分布情况 */
		sql = "SELECT 
				institute_id, institute_name, institute_short, 
				exam_id, 
				scroll_avg, scroll_high, scroll_low, 
				student_taken, student_passed  
				FROM mv_institute_cet_status 
				ORDER BY institute_short ";
		
		queryObj = new Query( datasource=application.dnsSlave );

		rs_institute = queryObj.execute( sql=sql ).getResult();


		instituteArray = [];
		
		statStruct = {};
		
		for( a=1; a LTE rs_institute.recordCount; a++ ){
			
			if ( not arrayFind( instituteArray, [ rs_institute["institute_id"][a], rs_institute["institute_name"][a], rs_institute["institute_short"][a] ] ) ) {
				arrayAppend( instituteArray, [ rs_institute["institute_id"][a], rs_institute["institute_name"][a], rs_institute["institute_short"][a] ] );
			}

			structInsert( statStruct, rs_institute["exam_id"][a] & "-" & rs_institute["institute_id"][a] & "-HL", [ rs_institute["scroll_low"][a], rs_institute["scroll_high"][a] ], true );
			structInsert( statStruct, rs_institute["exam_id"][a] & "-" & rs_institute["institute_id"][a] & "-TP", [ rs_institute["student_passed"][a], rs_institute["student_taken"][a] ], true );

			if ( rs_institute["student_taken"][a] gt 0 and rs_institute["student_passed"][a] gt 0 ) {
				structInsert( statStruct, rs_institute["exam_id"][a] & "-" & rs_institute["institute_id"][a] & "-PR", numberFormat(100 * rs_institute["student_passed"][a]/rs_institute["student_taken"][a], "__._"), true );
			}
			
			structInsert( statStruct, rs_institute["exam_id"][a] & "-" & rs_institute["institute_id"][a] & "-AVG", rs_institute["scroll_avg"][a], true );
			
		}

	</cfscript>
</cfsilent>

<div class="noticeBlock">
	<h3>各学院四六级通过率对比图</h3>
	<hr/>
</div>

<div id="containerPassRate" style="height:350px; width:740px;"></div>

<script language="javascript" type="text/javascript">
	//<![CDATA[
	<!--

	$(document).ready(function() {
		
		$('#containerPassRate').highcharts({
			
			colors: ['#4572A7','#AA4643','#89A54E','#80699B'],
			title: {
				text: null
				},
			subtitle: {
				text: null
				},
			xAxis: {
				categories: [<cfset i = 0 /><cfloop array="#instituteArray#" index="institute"><cfset i++ />'<cfoutput>#institute[3]#</cfoutput>'<cfif i lt arrayLen(instituteArray)>,</cfif></cfloop>], 
				labels: {
					style: {
						fontSize: '12px'
						}
					}
				},
			yAxis: {
				min: 0,
				title: {
					text: null
					}
				},
			tooltip: {
				valueSuffix: " %"
				},
			credits: {
				enabled: false
				},
			legend: {
				enabled: true
				},
			series: [{
				type: 'column',
				name: '四级通过率',
				data: [
						<cfset i = 0 /><cfloop array="#instituteArray#" index="institute"><cfset i++ /><cfif structKeyExists( statStruct, "CET4-" & institute[1] & "-PR" )><cfoutput>#statStruct["CET4-" & institute[1] & "-PR"]#</cfoutput><cfelse>null</cfif><cfif i lt arrayLen(instituteArray)>,</cfif></cfloop>
						]
					},{
				type: 'column',
				name: '六级通过率',
				data: [
						<cfset i = 0 /><cfloop array="#instituteArray#" index="institute"><cfset i++ /><cfif structKeyExists( statStruct, "CET6-" & institute[1] & "-PR" )><cfoutput>#statStruct["CET6-" & institute[1] & "-PR"]#</cfoutput><cfelse>null</cfif><cfif i lt arrayLen(instituteArray)>,</cfif></cfloop>
						]
					}]
		});
		
	});
	
	$(document).ready(function() {
		
		$("#cetReportDetailTrigger").click(function(){
			
			$("#cetReportSummary").addClass("hidden_elem");
			$("#cetReportDetail").removeClass("hidden_elem");
		
		});
		
		$("#cetReportSummaryTrigger").click(function(){
			
			$("#cetReportDetail").addClass("hidden_elem");
			$("#cetReportSummary").removeClass("hidden_elem");
		
		});
		
	});
					
	// -->
	//]]>
</script>

<div id="cetReportSummary" class="mtl mbl">
	<div class="noticeBlock">
		<div class="operation" style="height:40px;">
			<a id="cetReportDetailTrigger" class="uiButton" href="javascript:void(0);"><i class="mrs img btnShow"></i><span class="uiButtonText">明细</span></a>
		</div>
	</div>
	<table class="UItable">
		<tr class="cellBorder cellCenter">
			<td>学院</td>
			<cfloop array="#instituteArray#" index="institute">
				<td><cfoutput>#institute[3]#</cfoutput></td>
			</cfloop>
		</tr>
		<tr class="cellBorder cellCenter">
			<td><span class="number">CET4</span></td>
			<cfloop array="#instituteArray#" index="institute">
				<td><cfif structKeyExists( statStruct, "CET4-" & institute[1] & "-TP" )>
						<cfset percent =  numberFormat( 100 * ( statStruct["CET4-" & institute[1] & "-TP"][1] / statStruct["CET4-" & institute[1] & "-TP"][2] ), "__._" ) />
						<span class="number"><cfoutput>#percent#</cfoutput></span>
					</cfif></td>
			</cfloop>
		</tr>
		<tr class="cellBorder cellCenter">
			<td><span class="number">CET6</span></td>
			<cfloop array="#instituteArray#" index="institute">
				<td><cfif structKeyExists( statStruct, "CET6-" & institute[1] & "-TP" )>
						<cfset percent =  numberFormat( 100 * ( statStruct["CET6-" & institute[1] & "-TP"][1] / statStruct["CET6-" & institute[1] & "-TP"][2] ), "__._" ) />
						<span class="number"><cfoutput>#percent#</cfoutput></span>
					</cfif></td>
			</cfloop>
		</tr>
	</table>
</div>

<div id="cetReportDetail" class="mtl mbl hidden_elem">
	<div class="noticeBlock">
		<div class="operation" style="height:40px;">
			<a id="cetReportSummaryTrigger" class="uiButton" href="javascript:void(0);"><i class="mrs img btnHide"></i><span class="uiButtonText">汇总表</span></a>
		</div>
	</div>
	<table class="UItable">
		<tr class="cellBorder">
			<td rowspan="2">学院 / 考试级别</td>
			<td colspan="4" align="center">英语四级</td>
			<td colspan="4" align="center">英语六级</td>
		</tr>
		<tr class="cellBorder cellCenter">
			<td>通过率</td>
			<td>平均分</td>
			<td>最高分</td>
			<td>最低分</td>
			<td>通过率</td>
			<td>平均分</td>
			<td>最高分</td>
			<td>最低分</td>
		</tr>
		<cfloop array="#instituteArray#" index="institute">
			<tr class="cellBorder ">
				<td><cfoutput>#institute[2]#</cfoutput></td>
				<!--- CET4 --->
				<td align="center">
					<cfif structKeyExists( statStruct, "CET4-" & institute[1] & "-TP" )>
						<cfset percent =  numberFormat( 100 * ( statStruct["CET4-" & institute[1] & "-TP"][1] / statStruct["CET4-" & institute[1] & "-TP"][2] ), "__._" ) />
						<span class="number"><cfoutput>#percent#</cfoutput> %</span>
					</cfif>
				</td>
				<td align="center">
					<cfif structKeyExists( statStruct, "CET4-" & institute[1] & "-AVG" )>
						<span class="number"><cfoutput>#statStruct[ "CET4-" & institute[1] & "-AVG" ]#</cfoutput></span>
					</cfif>
				</td>
				<cfif structKeyExists( statStruct, "CET4-" & institute[1] & "-HL" )>
					<td align="center"><span class="number"><cfoutput>#statStruct[ "CET4-" & institute[1] & "-HL" ][2]#</cfoutput></span></td>
					<td align="center"><span class="number"><cfoutput>#statStruct[ "CET4-" & institute[1] & "-HL" ][1]#</cfoutput></span></td>
					<cfelse>
					<td colspan="2"></td>
				</cfif>
				<!--- CET6 --->
				<td align="center">
					<cfif structKeyExists( statStruct, "CET6-" & institute[1] & "-TP" )>
						<cfset percent =  numberFormat( 100 * ( statStruct["CET6-" & institute[1] & "-TP"][1] / statStruct["CET6-" & institute[1] & "-TP"][2] ), "__._" ) />
						<span class="number"><cfoutput>#percent#</cfoutput> %</span>
					</cfif>
				</td>
				<td align="center">
					<cfif structKeyExists( statStruct, "CET6-" & institute[1] & "-AVG" )>
						<span class="number"><cfoutput>#statStruct[ "CET6-" & institute[1] & "-AVG" ]#</cfoutput></span>
					</cfif>
				</td>
				<cfif structKeyExists( statStruct, "CET6-" & institute[1] & "-HL" )>
					<td align="center"><span class="number"><cfoutput>#statStruct[ "CET6-" & institute[1] & "-HL" ][2]#</cfoutput></span></td>
					<td align="center"><span class="number"><cfoutput>#statStruct[ "CET6-" & institute[1] & "-HL" ][1]#</cfoutput></span></td>
					<cfelse>
					<td colspan="2"></td>
				</cfif>
			</tr>
		</cfloop>
	</table>
</div>



